package com.hsw.cms.dao;

import java.util.List;

import org.nutz.dao.Cnd;
import org.nutz.dao.Condition;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.annotation.Param;

import com.hsw.cms.model.Manager;
import com.hsw.cms.model.News;
import com.hsw.cms.utils.SystemContext;
/**
 * 管理员数据库访问
 * @author Administrator
 *
 */
@IocBean
public class NewsDao extends BasicDao {
	/**
	 * 管理员登录
	 * @param username
	 * @param password
	 * @return
	 */
	public List newsList(Class cls,Condition cnd,int currentPage){
		return searchByPage(News.class, Cnd.orderBy().desc("createDate"), currentPage, SystemContext.PAGE_SIZE);
	}
	
	public int maxPage(int count){
		return maxPageSize(count, SystemContext.PAGE_SIZE);
	}
	
	public int newsCount(Class cls,Condition cnd){
		return searchCount(cls, cnd);
	}
	
//	List<Article> list = basicDao.searchByPage(Article.class, Cnd.orderBy()
//			.desc("createDate"), currentPage, SystemContext.PAGE_SIZE);
//
//	int count = basicDao.searchCount(Article.class);
//
//	int maxPage = basicDao.maxPageSize(count, SystemContext.PAGE_SIZE);

}
